<?php

	session_start();

	include('functions.php');
	
	$congress = obtenerCongress($_SESSION['idcongress']);

	$bgcolor = $congress['BACKGROUND_COLOR'];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

	<title><?php echo $congress['NAME']; ?></title>

	<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
	<link href="accordion/style.css" rel="stylesheet" type="text/css" media="screen" />

	<script src="accordion/accordian.pack.js" language="javascript" type="text/javascript">
	</script>

	<style>
		body {
			padding: 0px;
			margin: 0px;
		}
		
		.bodybg {
			background: <?php echo $bgcolor; ?>
			filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='<?php echo $bgcolor; ?>', endColorstr='#FFFFFF');
			background: -webkit-gradient(linear, left top, left bottom, from(<?php echo $bgcolor; ?>), to(#FFFFFF));
			background: -moz-linear-gradient(top,  <?php echo $bgcolor ?>,  #FFFFFF);
			width:100%;
			height: 600px;
		}
	</style>

</head>

<body onload="new Accordian('basic-accordian',10,'header_highlight');">

	<div align="center" class="bodybg">

		<?php include('main_header.php'); ?>

		<?php include('botonera.php'); ?>
		

		
		<?php
		
			$search = getValor('search');

			$sessions = NULL;
			$cantSessions = 0;

			
			if (strlen($search) > 0) {
				$sessions = obtenerSessionsPorCongressYNombre($_SESSION['idcongress'], $search);
				$cantSessions = obtenerCantidadSesionsPorCongressYNombre($_SESSION['idcongress'], $search);
			} else {
				$sessions = obtenerSessionsPorCongress($_SESSION['idcongress']);
				$cantSessions = obtenerCantidadSesionsPorCongress($_SESSION['idcongress']);
			}

			$first = true;
		?>

		<?php include('session_header.php'); ?>
		
		<div style="width: 880px;">
			<div id="basic-accordian" >
					
				<?php  if ($cantSessions > 0) { ?>				
					<?php while ($row_session = mysql_fetch_assoc($sessions)) {	?>
					
							<?php $sessionname = trim($row_session['NAME']) ?>
							<?php $sessionid = trim($row_session['ID_SESSION']) ?>
					
						  	<div id="session<?php echo $sessionid; ?>-header" 
								class="accordion_headings<?php if ($first) { echo " header_highlight"; $first = false; } ?>" >
								<?php echo $sessionname; ?>						  	
							</div>
				  
				  			<div id="session<?php echo $sessionid; ?>-content">

							<?php
								$abstracts = obtenerAbstractsPorSession($sessionid);
								$cantAbstr = mysql_num_rows($abstracts);
								$cantSessions = obtenerCantidadAbstractsPorSession($sessionid);
							?>

					
							<div class="accordion_child" <?php if ($cantAbstr > 15) { ?> style="height: 300px; overflow:auto;" <?php } ?>>

								
								<?php if ($cantSessions > 0) { ?>
								
									<?php while ($row_abstract = mysql_fetch_assoc($abstracts)) { ?>

										<?php if ($row_abstract['SHOW_ABSTRACT']) { ?>

										<table>
											<tr>
												<td width="50">
													<?php  if ($row_abstract['SHOW_PROCEEDING']) { ?>
														<img src="images/icon_book.png" />
													<?php } ?>
												</td>
												<td>
													<a onclick="window.open('abstract_proceeding_viewer.php?idabstract=<?php echo $row_abstract['ID_ABSTRACT']; ?>', 
														'abstract_proceeding', 'location=0, status=0, scrollbars=1, width=800, height=700');" href="#">
														<?php echo $row_abstract['TITLE']; ?>
													</a>
												</td>
											</tr>									
										</table>
										
										<?php } ?>

									<?php } ?>
								<?php } ?>
							</div>
						</div>
					<?php } ?>
				<?php } else { echo "No Sessions Found"; } ?>
			</div>
		</div>
		
	</div>

</body>
</html>
